<?php

namespace app\model;

use think\Model;

class CustomerField extends Model
{


    protected $connection = 'mysql';

    protected $pk = 'id';

    protected $name = 'customer_field';

    public static function getField() {
        return self::where(['weid' => weid(),'status'=>1])->order('sort asc,id asc')->select()->toArray();
    }
    public static function getsysField() {
        return self::where(['weid' => weid(),'is_sys'=>1,'status'=>1])->order('sort asc,id asc')->select()->toArray();
    }
    public static function getsnoysField() {
        return self::where(['weid' => weid(),'is_sys'=>0,'status'=>1])->order('sort asc,id asc')->select()->toArray();
    }
    public static function getimportField() {
        return self::where(['weid' => weid(),'is_import'=>1,'status'=>1])->order('sort asc,id asc')->select()->toArray();
    }
    public static function getlistViewField() {
        return self::where(['weid' => weid(),'is_listView'=>1,'status'=>1])->order('sort asc,id asc')->select()->toArray();
    }

    public static function datainitial()
    {
        $weid = weid();
        $data[1] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'mingcheng',
            'viewmingcheng' => '客户名称',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'text',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];

        $data[2] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'mobile',
            'viewmingcheng' => '手机号',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'text',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];
        $data[3] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'sex',
            'viewmingcheng' => '性别',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'radio',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];
        $data[4] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'jieduan',
            'viewmingcheng' => '阶段',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'select',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];
        $data[5] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'ctype',
            'viewmingcheng' => '客户标签',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'select',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];

        $data[6] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'laiyuan',
            'viewmingcheng' => '客户来源',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'select',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];

        $data[7] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'nianling',
            'viewmingcheng' => '年龄',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'text',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];

        $data[8] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'email',
            'viewmingcheng' => '电子邮件',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'text',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];

        $data[9] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'qq',
            'viewmingcheng' => 'QQ',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'text',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];

        $data[10] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'weixin',
            'viewmingcheng' => '微信号',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'text',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];

        $data[11] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'tel',
            'viewmingcheng' => '电话',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'text',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];
        $data[11] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'province_id',
            'viewmingcheng' => '省',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'select',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];

        $data[12] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'city_id',
            'viewmingcheng' => '市',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'select',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];

        $data[13] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'country_id',
            'viewmingcheng' => '县/区',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'select',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];

        $data[14] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'dizhi',
            'viewmingcheng' => '地址',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'text',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];

        $data[14] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'texts',
            'viewmingcheng' => '备注',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'textarea',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];
        $data[15] = [
            'weid' => $weid,
            'fieldsmingcheng' => 'gj_time',
            'viewmingcheng' => '下次跟进时间',
            'is_sys' => 1,
            'is_listView' => 0,
            'is_search' => 0,
            'inputtype' => 'date',
            'selectvalue' => '',
            'defaultvalue' => '',
            'filetype' => '',
            'shuoming' => '',
            'create_time' => time(),
            'update_time' => time(),
            'sort' => 100,
            'status' => 1,
        ];
        $mod = new self;
        $mod->saveAll($data);
    }
}
